﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

#if !WINRT
using System.Windows;
using System.Windows.Controls;
#else

using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
#endif

namespace MishraReader
{
    /// <summary>
    ///   A DataTemplateSelector that bases its DataTemplate decisions on a TemplateFinder which is possibly in a different logical tree.
    /// </summary>
    internal class TunnelDataTemplateSelector : DataTemplateSelector
    {
        private readonly TemplateFinder _templateFinder;

        public TunnelDataTemplateSelector(TemplateFinder templateFinder)
        {
            _templateFinder = templateFinder;
        }

#if !WINRT
        public 
#else
        protected
#endif
            override DataTemplate 
#if !WINRT
            SelectTemplate
#else
            SelectTemplateCore
#endif
            (object item, DependencyObject container)
        {
            var template = _templateFinder.FindTemplate(item);
            return template;
        }
    }
}